package com.zsc.wxm.ysh.anjo.sms.controller;

import com.zsc.wxm.ysh.anjo.result.Result;
import com.zsc.wxm.ysh.anjo.sms.service.MailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 描述：
 *
 * @author playmaker
 * @since 2021/2/9 1:05
 */
@RestController
@RequestMapping("/common/mail")
@Api(tags = "发送邮件接口")
public class MailController {
    @Resource
    private MailService mailService;

    @PostMapping("/send-back-password-email")
    @ApiOperation("返回找回密码的邮件")
    public Result sendBackPasswordEmail(@RequestParam("email") String email) {
        mailService.sendBackPasswordEmail(email);
        return Result.ok("邮件已发送");
    }


    @PostMapping("/send-view-request-email")
    @ApiOperation("发送看房请求信息给房东")
    public Result sendViewRequestEmail(@RequestParam("code") String code, @RequestParam("email") String email) {
        mailService.sendViewRequest(code, email);
        return Result.ok("邮件已发送");
    }
}
